//
//  UIButton+Extension.swift
//  TinyShopKeeper
//
//  Created by rimi on 16/5/26.
//  Copyright © 2016年 jfy. All rights reserved.
//

import Foundation
import UIKit //导入

//登陆按钮渐变色
extension UIButton{
    func addBackgroundLayer(frame:CGRect){
        let layer = CAGradientLayer()
        layer.frame = frame
        layer.colors = [MZColor(235, green: 56, blue: 0).CGColor,MZColor(208, green: 27, blue: 25).CGColor]
        //渲染圆角
        layer.cornerRadius = 5
        layer.masksToBounds = true
        //开始位置
        layer.startPoint = CGPointMake(0, 0.5)
        //结束位置
        layer.endPoint = CGPointMake(1, 0.5)
        //插入layer
        self.layer.insertSublayer(layer, atIndex: 0)
    }
}